package com.camps.sdk.decrypt;

import com.camps.sdk.common.Constants;
import com.camps.sdk.entity.DeviceUpMessage;
import com.camps.sdk.entity.WhiteCallSwitch;

/**
 * @Author ldaoliang
 * @Date create in 15:58 2021/9/1
 * @Description
 */
public class AnalyzeWhiteCallSwitch implements AnalyticalData {
    @Override
    public DeviceUpMessage parseData(String originalData)
    {
        // *WT,866248050395985,V4,CALLFILTER,101247,1,030621,FFFFDFFF#
        //解密
        String[] split = parseCommand(originalData);
        String imei=split[1];
        String commandNumber=split[4];
        String flag=split[5];
        String deviceDate = split[6];
        String deviceStatus=split[7];//设备状态
        WhiteCallSwitch whiteCallSwitch  = new WhiteCallSwitch();
        whiteCallSwitch.setImei(imei);
        whiteCallSwitch.setDeviceTime(commandNumber);
        whiteCallSwitch.setCommandNumber(commandNumber);
        whiteCallSwitch.setFlag(Integer.parseInt(flag));
        whiteCallSwitch.setDeviceStatus(deviceStatus);
        whiteCallSwitch.setDeviceDate(deviceDate);
        return structureMessage(Constants.REPLY,Constants.CMD_WHITE_CALL_SWITCH,false,"",whiteCallSwitch);
    }
}
